﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Arbore
{
    public class Arbore : IComand
   {
        Nod radacina;
        Nod nodCurent;

       public Arbore()
       {
           radacina=new Nod();
           nodCurent = radacina;
       }

       public void AddD(Nod a)
       {
           if (radacina.Value == string.Empty)
           {
               radacina = a;
               nodCurent = radacina;
           }
           else
           {
               a.parentNode = nodCurent;
               nodCurent.Childrens.Add(a);
               nodCurent = a;
           }
       }

       public Nod Radacina
       {
           get { return radacina; }
           set {  radacina = value; }

       }
       public Nod CurrentNod
       {
           get { return nodCurent; }
           set { nodCurent = value; }
       }
       public void up()
       {
           nodCurent = nodCurent.parentNode;
       }
       public void AddS(Nod a)
       {
           if (radacina.Value == string.Empty)
           {
               radacina = a;
               nodCurent = radacina;
           }
           else
           {
               a.parentNode = nodCurent;
               nodCurent.Childrens.Insert(0, a);
               nodCurent = a;
           }
       }




   }
}
